<template>
  <div id="app">
    <div id="xgplayer"></div>
  </div>
</template>

<script>
import "xgplayer";
import HlsPlayer from "xgplayer-hls";

export default {
  name: "App",
  data() {
    return {
      player: null,
      playerConfig: {
        id: "xgplayer",
        isLive: true, // 直播模式
        autoplay: true,
        fluid: true,
        controls: false,
        url: "/hls/hls/cctv1.m3u8" // 直播地址
      }
    };
  },
  mounted() {
    this.player = new HlsPlayer(this.playerConfig);
  }
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
</style>
